package com.jiyun.controller;

import com.jiyun.mapper.OrderMapper;
import com.jiyun.pojo.DcDriver;
import com.jiyun.pojo.DcOrder;
import com.jiyun.service.OrderService;
import com.jiyun.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

@RestController
@CrossOrigin
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;
    @Autowired
    private OrderMapper orderMapper;
    @GetMapping("/findAll")
    public List<DcOrder> findAll() {
        return orderMapper.selectList(null);
    }
    @GetMapping("/find")
    public List<DcOrder> find(@RequestParam("status") Integer status) {
        System.out.println("status = " + status);
        List<DcOrder> list = orderService.getStatusFind(status);
        return list;
    }
    @GetMapping("findOne")
    public DcOrder findOne(@RequestParam("id") Integer id) {
        DcOrder byId = orderService.getById(id);
        System.out.println("byId = " + byId);
        return byId;
    }
    @RequestMapping("jiedanNum")
    public Integer jiedanNum(Integer id) {
        Integer num = orderService.jiedanNum(id);
        return num;
    }
    @RequestMapping("liushuimoney")
    public BigDecimal liushuimoney(Integer id) {
        return orderService.liushuimoney(id);
    }
    @RequestMapping("yunyingshichang")
    public BigDecimal yunyingshichang(Integer id) {
        return orderService.yunyingshichang(id);
    }


}
